package com.aks.server.service.impl;

import com.aks.server.domain.response.ResponseResult;
import com.aks.server.domain.request.param.ActivityParam;
import com.aks.server.entity.ActivityEntity;
import com.aks.server.mapper.ActivityMapper;
import com.aks.server.service.ActivityService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("activityService")
public class ActivityServiceImpl extends BaseServiceImpl implements ActivityService {
    @Resource
    private ActivityMapper activityMapper;

    @Override
    public ActivityEntity createActivity(ActivityEntity activityEntity) {
        activityMapper.insert(activityEntity);
        return activityEntity;
    }

    @Override
    public ResponseResult<?> updateActivity(ActivityParam param) {
        ActivityEntity entity = new ActivityEntity();
        BeanUtils.copyProperties(param, entity);
        activityMapper.updateById(entity);
        return ResponseResult.success(null, entity);
    }

    @Override
    public ResponseResult<?> deleteActivity(Long id) {
        return null;
    }

    @Override
    public ResponseResult<?> getActivityById(Long id) {
        ActivityEntity activity = activityMapper.selectById(id);
        return ResponseResult.success(null, activity);
    }

    @Override
    public List<ActivityEntity> getActivitiesByCoachId(String coachId) {
        return activityMapper.getActivitiesByCoachId(coachId);
    }


} 